<!DOCTYPE html>
<html lang="en" ng-app="myFilter">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="js/angular-1.3.0.js"></script>
</head>
<body>
<div ng-controller="MyCtrl">
    <ul>
        <!-- 自定义复合匹配（函数） -->
        <li ng-repeat="p in data | myFilter:type:0" ng-class-odd="'odd'" ng-class-even="'even'">
            <span>{{$index + 1}}</span>--<span>{{p.name}}</span>--<span>{{p.age}}</span>--<span>{{p.score}}</span>
        </li>
    </ul>
</div>
<script type="text/javascript">
    var myModule = angular.module("myFilter", []);
    myModule.controller("MyCtrl", ["$scope", function ($scope) {
        $scope.data = [
            {name: "jj", age: 26, score: 80,sex:'男'},
            {name: "zj", age: 24, score: 54,sex:'女'},
            {name: "demo", age: 24, score: 81,sex:'女'},
            {name: "demo2", age: 29, score: 94,sex:'女'}
        ];
    }]);
    
    // 定义过滤器
    myModule.filter("myFilter",function () {
        return function (data,type) {
            var arr = [];
            var sex = type?'男':'女';
            for(var i=0;i < data.length; i++){
                if(data[i].age > 22 && data[i].age < 28 && data[i].sex ==sex){
                    arr.push(data[i]);
                }
            }
            return arr;
        }
    });
</script>
</body>
</html>